import requests from '@/api/ajax.js'


//首页轮播图
export const gethomecasual=()=>requests({url:'/homecasual'})
//首页分类数组
export const getcategory=()=>requests({url:"/category"})
//首页分类列表
export const gethomeshoplist=()=>requests({url:"/homeshoplist"})
//登录验证码
export const getphonecode=(phone)=>requests({url:"/send_code",params:{phone},method:"get"})
//手机验证码登录
export const phoneCodeLogin=(phone,code)=>requests({url:"/login_code",method:"post",data:{phone,code}})
//密码登录
export const pwdlogin =(zh,mm)=>requests({url:"/login_pwd",method:"post",data:{zh,mm}})
//同步用户数据
export const getuserinfo=(params)=>requests({url:"/userinfo",method:"get",params:params})
//退出登录
export const getlogout =()=>requests({url:"/logout",method:"get"})
//获取商品详情
export const getgooddetail=(id)=>requests({url:"/detail",params:id})
//商品详情评论
export const getgoodcomment=(id)=>requests({url:"/comment",params:id})
//发布评论
export const postcomment=(id,comment,rating,uid)=>requests({url:"/postcomment",method:"post",data:{id,comment,rating,uid}})
//获取推荐商品的数据
export const getRecommendShopList=(data)=>requests({url:"/recommendshoplish",params:data})
//模糊查询
export const gogetsearch=(word)=>requests({url:"/searchgood",data:word,method:"post"})
//添加购物车
export const addcart=(user_id, goods_id, goods_name, thumb_url, price,buy_count, counts)=>requests({url:"/addcart",data:{user_id, goods_id, goods_name, thumb_url, price,buy_count, counts},method:"post"})
//请求购物车
export const getCartsGoods=(params)=>requests({url:"/cartgoods",params:params})
//购物车的单个数量改变
export const changgoodsnum=(goods, num, user_id)=>requests({url:"/change_goods_count", method:"post",data:{goods, num, user_id}})
//删除单个商品
export const deletegood=(goods_id, user_id)=>requests({url:"/delete_goods", method:"post",data:{goods_id, user_id}})
//删除全部商品
export const deletegoodall=(user_id)=>requests({url:"/delete_goods_all", method:"post",data:{user_id}})
//批量删除
export const pldelete=(id,a)=>requests({url:"/pldelete", method:"post",data:{id,a}})
//修改用户信息
export const  changeuserinfo=(params)=>requests({url:"/changeuserinfo", method:'post',data:params})
//修改用户密码
export const  chengpwd=(id,lowpad,newpwd)=>requests({url:"/changeuserpwd", method:'post',data:{id,lowpad,newpwd}})
//管理员登录
export const  adminlogin=(zhh,mmm)=>requests({url:"/adminlogin", method:'post',data:{zhh,mmm}})
//所有商品的信息
export const allgoods=()=>requests({url:"/allgoods"})
//修改商品信息（后台）
export const changegoods=(params)=>requests({url:"/changedgoods",method:"post",data:params})
//删除商品信息（后台）
export const deletegoods=(id)=>requests({url:"/deletegoods",method:"post",data:id})
//后台的商品上架
export const addgoodrecom=(params)=>requests({url:"/addgoodrecom",method:"post",data:params})
//所有用户信息
export const alluser=()=>requests({url:"/alluser"})

